package com.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class SessionController {
    @GetMapping("/test")
    public String login(@RequestParam("username") String username, HttpServletRequest request){
        /*将用户信息放在Session中*/
        request.getSession().setAttribute("user", username);
         return "登录成功";
    }
}
